package org.zasadnyy.redlions.players.client.ui;

import org.zasadnyy.redlions.players.shared.model.PlayerItem;

import com.smartgwt.client.types.Orientation;
import com.smartgwt.client.types.TileLayoutPolicy;
import com.smartgwt.client.widgets.tile.TileGrid;
import com.smartgwt.client.widgets.viewer.DetailViewerField;

public class PlayersTileGrid extends TileGrid {

	public PlayersTileGrid() {
		super();
		initTileGrid();
	}

	private void initTileGrid() {
		setTileHeight(165);
		setLayoutPolicy(TileLayoutPolicy.FIT);
		setExpandMargins(false);
		setTilesPerLine(4);
		setOrientation(Orientation.HORIZONTAL);
		setHeight(PlayerCanvas.APP_HEIGHT);
		setWidth(PlayerCanvas.APP_WIDTH);
		setCanReorderTiles(false);
		setShowAllRecords(true);
		setShowEdges(false);
		setBorder("2px solid black");

		DetailViewerField pictureField = new DetailViewerField(
				PlayerItem.PHOTO_URL);
		pictureField.setType("image");
		pictureField.setImageURLPrefix("photos/");
		// pictureField.setImageWidth(186);
		pictureField.setImageHeight(120);

		DetailViewerField nameField = new DetailViewerField(PlayerItem.NAME);
		DetailViewerField priceField = new DetailViewerField(PlayerItem.SURNAME);

		setFields(pictureField, nameField, priceField);
	}

}
